package com.nekonomics
package api.dto.response

import domain.detail.SkuDetail
import domain.entity.{Sku}
import types.Money

import zio.json.*


case class SkuCardDto(
  id: Long,
  title: String,
  price: Money,
  spuId: Long,
  imageUrl: Option[String] = None
) derives JsonEncoder


object SkuCardDto {

  def fromSkuDetail(skuDetail: SkuDetail): SkuCardDto =
    SkuCardDto(
      id = skuDetail.id,
      title = skuDetail.name,
      price = skuDetail.price,
      spuId = skuDetail.spuId,
      imageUrl = skuDetail.imageUrl
    )

}